home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / srcuc.zip / CMPI386.ASM < prev    next >
Assembly Source File  |  1992-04-14  |  21KB  |  943 lines

  1. .386
  2. .model small
  3.     .data
  4.     extrn _Free:dword
  5.     extrn _Ext_Stack_Pointer:dword
  6.     extrn _utility_table:dword
  7.     public _C_Stack_Segment
  8. _C_Stack_Segment dd 0
  9.     public _C_Stack_Pointer
  10. _C_Stack_Pointer dd 0
  11.     public _C_Frame_Pointer
  12. _C_Frame_Pointer dd 0
  13.     public _i387_presence
  14. _i387_presence dd 0
  15.     public _Regstart
  16. _Regstart db 128 dup (0)
  17.     public _Registers
  18. _Registers db 3456 dup (0)
  19.     .code
  20.     public _i386_interface_initialize
  21. _i386_interface_initialize:
  22.     push    ebp
  23.     mov    ebp,esp
  24.     xor    eax,eax        ; No 387 available
  25.     
  26.     smsw        cx
  27.     mov    edx,012H
  28.     and    ecx,edx
  29.     cmp    ecx,edx
  30.     jne    i386_initialize_no_fp
  31.     inc    eax            ; 387 available
  32.     sub    esp,4
  33.     fclex
  34.     fnstcw    word ptr -2[ebp]
  35.     ; Set rounding mode to round-to-even, precision control to double,
  36.     ; mask the inexact result exception, and unmask the other exceptions.
  37.     and    word ptr -2[ebp],0f0e0H
  38.     or    word ptr -2[ebp],00220H
  39.     fldcw    word ptr -2[ebp]
  40. i386_initialize_no_fp:
  41.     mov    _i387_presence,eax
  42.     leave
  43.     ret
  44.     public _C_to_interface
  45. _C_to_interface:
  46.     push    ebp            ; Link according
  47.     mov    ebp,esp        ;  to C's conventions
  48.     push    edi            ; Save callee-saves
  49.     push    esi            ;  registers
  50.     push    ebx
  51.     mov    edx,dword ptr 8[ebp]    ; Entry point
  52.                             ; Preserve frame ptr
  53.     mov    _C_Frame_Pointer,ebp
  54.                             ; Preserve stack ptr
  55.     mov    _C_Stack_Pointer,esp
  56.                             ; Register block = %esi
  57.     mov    ax,ss        ; Obtain stack segment
  58.     mov    _C_Stack_Segment,eax
  59.                             ; and preserve it
  60.     lea    esi,dword ptr _Registers
  61.     jmp    _interface_to_scheme
  62.     public _asm_trampoline_to_interface
  63. _asm_trampoline_to_interface:
  64.     public trampoline_to_interface
  65. trampoline_to_interface:
  66.     pop    ecx            ; trampoline storage
  67.     jmp    scheme_to_interface
  68.     public _asm_scheme_to_interface_call
  69. _asm_scheme_to_interface_call:
  70.     public scheme_to_interface_call
  71. scheme_to_interface_call:
  72.     pop    ecx            ; arg1 = ret. add
  73.     add    ecx,4        ; Skip format info
  74.     public _asm_scheme_to_interface
  75. _asm_scheme_to_interface:
  76.     public scheme_to_interface
  77. scheme_to_interface:
  78.     mov    _Ext_Stack_Pointer,esp
  79.     mov    _Free,edi
  80.     mov    edi,_C_Stack_Segment ; Swap stack segments
  81.     mov    ss,di
  82.     mov    esp,_C_Stack_Pointer
  83.     mov    ebp,_C_Frame_Pointer
  84.     push    dword ptr 36[esi] ; Utility args
  85.     push    ebx
  86.     push    edx
  87.     push    ecx
  88.     xor    ecx,ecx
  89.     mov    cl,al
  90.     mov    eax,dword ptr _utility_table[ecx*4]
  91.     call    eax
  92.     public scheme_to_interface_return
  93. scheme_to_interface_return:
  94.     add    esp,16        ; Pop utility args
  95.     mov    edx,dword ptr 4[eax]
  96.     mov    eax,dword ptr [eax]
  97.     jmp    eax                ; Invoke handler
  98.     public _interface_to_scheme
  99. _interface_to_scheme:
  100.     mov    edi,_Free        ; Free pointer = %edi
  101.                             ; Value/dynamic link
  102.     mov    eax,dword ptr 8[esi]
  103.     mov    ebp,67108863    ; = %ebp
  104.     mov    esp,_Ext_Stack_Pointer
  105.     mov    bx,ds        ; Swap stack segments
  106.     mov    ss,bx
  107.     mov    ecx,eax        ; Preserve if used
  108.     and    ecx,ebp        ; Restore potential
  109.                             ;  dynamic link
  110.     mov    dword ptr 16[esi],ecx
  111.     jmp    edx
  112.     public _interface_to_C
  113. _interface_to_C:
  114.     cmp    _i387_presence,0
  115.     je    interface_to_C_proceed
  116.     ffree    st(0)                    ; Free floating "regs"
  117.     ffree    st(1)
  118.     ffree    st(2)
  119.     ffree    st(3)
  120.     ffree    st(4)
  121.     ffree    st(5)
  122.     ffree    st(6)
  123. interface_to_C_proceed:
  124.     mov    eax,edx        ; Set up result
  125.     pop    ebx            ; Restore callee-saves
  126.     pop    esi            ;  registers
  127.     pop    edi
  128.     leave
  129.     ret
  130.     
  131.     
  132.     public _asm_interrupt_procedure
  133. _asm_interrupt_procedure:
  134.     mov    al,01aH
  135.     jmp    scheme_to_interface_call
  136.     public _asm_interrupt_continuation
  137. _asm_interrupt_continuation:
  138.     mov    al,01bH
  139.     jmp    scheme_to_interface_call
  140.     public _asm_interrupt_closure
  141. _asm_interrupt_closure:
  142.     mov    al,018H
  143.     jmp    scheme_to_interface
  144.     public _asm_interrupt_dlink
  145. _asm_interrupt_dlink:
  146.     mov    edx,dword ptr 16[esi]
  147.     mov    al,019H
  148.     jmp    scheme_to_interface_call
  149.     public _asm_short_primitive_apply
  150. _asm_short_primitive_apply:
  151.     pop    edx            ; offset pointer
  152.     mov    ecx,dword ptr [edx]    ; offset
  153.                             ; Primitive object
  154.     mov    ecx,dword ptr [edx] [ecx]
  155.                             ; Merge
  156.     jmp    _asm_primitive_apply
  157.     public _asm_primitive_apply
  158. _asm_primitive_apply:
  159.     mov    al,012H
  160.     jmp    scheme_to_interface
  161.     public _asm_primitive_lexpr_apply
  162. _asm_primitive_lexpr_apply:
  163.     mov    al,013H
  164.     jmp    scheme_to_interface
  165.     public _asm_error
  166. _asm_error:
  167.     mov    al,015H
  168.     jmp    scheme_to_interface
  169.     public _asm_link
  170. _asm_link:
  171.     mov    al,017H
  172.     jmp    scheme_to_interface_call
  173.     public _asm_assignment_trap
  174. _asm_assignment_trap:
  175.     mov    al,01dH
  176.     jmp    scheme_to_interface_call
  177.     public _asm_reference_trap
  178. _asm_reference_trap:
  179.     mov    al,01fH
  180.     jmp    scheme_to_interface_call
  181.     public _asm_safe_reference_trap
  182. _asm_safe_reference_trap:
  183.     mov    al,020H
  184.     jmp    scheme_to_interface_call
  185.     public _asm_primitive_error
  186. _asm_primitive_error:
  187.     mov    al,036H
  188.     jmp    scheme_to_interface_call
  189.     public _asm_sc_apply
  190. _asm_sc_apply:
  191.     mov    eax,ecx        ; Copy for type code
  192.     mov    ebx,ecx        ; Copy for address
  193.     shr    eax,26    ; Select type code
  194.     and    ebx,ebp        ; Select datum
  195.     cmp    al,40
  196.     jne    asm_sc_apply_generic
  197.     movsx    eax,byte ptr -4[ebx]    ; Extract frame size
  198.     cmp    edx,eax        ; Compare to nargs+1
  199.     jne    asm_sc_apply_generic
  200.     jmp    ebx                ; Invoke
  201.     public asm_sc_apply_generic
  202. asm_sc_apply_generic:
  203.     mov    eax,014H
  204.     jmp    scheme_to_interface    
  205.     public _asm_sc_apply_size_1
  206. _asm_sc_apply_size_1:
  207.     mov    eax,ecx        ; Copy for type code
  208.     mov    ebx,ecx        ; Copy for address
  209.     shr    eax,26    ; Select type code
  210.     and    ebx,ebp        ; Select datum
  211.     cmp    al,40
  212.     jne    asm_sc_apply_generic_1
  213.     cmp    byte ptr -4[ebx],1    ; Compare frame size
  214.     jne    asm_sc_apply_generic_1    ; to nargs+1
  215.     jmp    ebx
  216. asm_sc_apply_generic_1:
  217.     mov    edx,1
  218.     mov    al,014H
  219.     jmp    scheme_to_interface
  220.     public _asm_sc_apply_size_2
  221. _asm_sc_apply_size_2:
  222.     mov    eax,ecx        ; Copy for type code
  223.     mov    ebx,ecx        ; Copy for address
  224.     shr    eax,26    ; Select type code
  225.     and    ebx,ebp        ; Select datum
  226.     cmp    al,40
  227.     jne    asm_sc_apply_generic_2
  228.     cmp    byte ptr -4[ebx],2    ; Compare frame size
  229.     jne    asm_sc_apply_generic_2    ; to nargs+1
  230.     jmp    ebx
  231. asm_sc_apply_generic_2:
  232.     mov    edx,2
  233.     mov    al,014H
  234.     jmp    scheme_to_interface
  235.     public _asm_sc_apply_size_3
  236. _asm_sc_apply_size_3:
  237.     mov    eax,ecx        ; Copy for type code
  238.     mov    ebx,ecx        ; Copy for address
  239.     shr    eax,26    ; Select type code
  240.     and    ebx,ebp        ; Select datum
  241.     cmp    al,40
  242.     jne    asm_sc_apply_generic_3
  243.     cmp    byte ptr -4[ebx],3    ; Compare frame size
  244.     jne    asm_sc_apply_generic_3    ; to nargs+1
  245.     jmp    ebx
  246. asm_sc_apply_generic_3:
  247.     mov    edx,3
  248.     mov    al,014H
  249.     jmp    scheme_to_interface
  250.     public _asm_sc_apply_size_4
  251. _asm_sc_apply_size_4:
  252.     mov    eax,ecx        ; Copy for type code
  253.     mov    ebx,ecx        ; Copy for address
  254.     shr    eax,26    ; Select type code
  255.     and    ebx,ebp        ; Select datum
  256.     cmp    al,40
  257.     jne    asm_sc_apply_generic_4
  258.     cmp    byte ptr -4[ebx],4    ; Compare frame size
  259.     jne    asm_sc_apply_generic_4    ; to nargs+1
  260.     jmp    ebx
  261. asm_sc_apply_generic_4:
  262.     mov    edx,4
  263.     mov    al,014H
  264.     jmp    scheme_to_interface
  265.     public _asm_sc_apply_size_5
  266. _asm_sc_apply_size_5:
  267.     mov    eax,ecx        ; Copy for type code
  268.     mov    ebx,ecx        ; Copy for address
  269.     shr    eax,26    ; Select type code
  270.     and    ebx,ebp        ; Select datum
  271.     cmp    al,40
  272.     jne    asm_sc_apply_generic_5
  273.     cmp    byte ptr -4[ebx],5    ; Compare frame size
  274.     jne    asm_sc_apply_generic_5    ; to nargs+1
  275.     jmp    ebx
  276. asm_sc_apply_generic_5:
  277.     mov    edx,5
  278.     mov    al,014H
  279.     jmp    scheme_to_interface
  280.     public _asm_sc_apply_size_6
  281. _asm_sc_apply_size_6:
  282.     mov    eax,ecx        ; Copy for type code
  283.     mov    ebx,ecx        ; Copy for address
  284.     shr    eax,26    ; Select type code
  285.     and    ebx,ebp        ; Select datum
  286.     cmp    al,40
  287.     jne    asm_sc_apply_generic_6
  288.     cmp    byte ptr -4[ebx],6    ; Compare frame size
  289.     jne    asm_sc_apply_generic_6    ; to nargs+1
  290.     jmp    ebx
  291. asm_sc_apply_generic_6:
  292.     mov    edx,6
  293.     mov    al,014H
  294.     jmp    scheme_to_interface
  295.     public _asm_sc_apply_size_7
  296. _asm_sc_apply_size_7:
  297.     mov    eax,ecx        ; Copy for type code
  298.     mov    ebx,ecx        ; Copy for address
  299.     shr    eax,26    ; Select type code
  300.     and    ebx,ebp        ; Select datum
  301.     cmp    al,40
  302.     jne    asm_sc_apply_generic_7
  303.     cmp    byte ptr -4[ebx],7    ; Compare frame size
  304.     jne    asm_sc_apply_generic_7    ; to nargs+1
  305.     jmp    ebx
  306. asm_sc_apply_generic_7:
  307.     mov    edx,7
  308.     mov    al,014H
  309.     jmp    scheme_to_interface
  310.     public _asm_sc_apply_size_8
  311. _asm_sc_apply_size_8:
  312.     mov    eax,ecx        ; Copy for type code
  313.     mov    ebx,ecx        ; Copy for address
  314.     shr    eax,26    ; Select type code
  315.     and    ebx,ebp        ; Select datum
  316.     cmp    al,40
  317.     jne    asm_sc_apply_generic_8
  318.     cmp    byte ptr -4[ebx],8    ; Compare frame size
  319.     jne    asm_sc_apply_generic_8    ; to nargs+1
  320.     jmp    ebx
  321. asm_sc_apply_generic_8:
  322.     mov    edx,8
  323.     mov    al,014H
  324.     jmp    scheme_to_interface
  325. asm_generic_flonum_result:
  326.     mov    dword ptr [edi],-1677721598
  327.     mov    eax,edi
  328.     fstp    qword ptr 4[edi]            ; fstpd
  329.     or    eax,402653184
  330.     and    dword ptr [esp],ebp
  331.     add    edi,12
  332.     mov    dword ptr 8[esi],eax
  333.     ret
  334. asm_generic_fixnum_result:
  335.     and    dword ptr [esp],ebp
  336.     or    al,26
  337.     ror    eax,6
  338.     mov    dword ptr 8[esi],eax
  339.     ret
  340. asm_generic_return_sharp_t:
  341.     and    dword ptr [esp],ebp
  342.     mov    dword ptr 8[esi],536870912
  343.     ret
  344. asm_generic_return_sharp_f:
  345.     and    dword ptr [esp],ebp
  346.     mov    dword ptr 8[esi],0
  347.     ret
  348.     public _asm_generic_divide
  349. _asm_generic_divide:
  350.     pop    edx
  351.     pop    ebx
  352.     mov    eax,edx
  353.     mov    ecx,ebx
  354.     shr    eax,26
  355.     shr    ecx,26
  356.     cmp    al,26
  357.     je    asm_generic_divide_fix
  358.     cmp    al,6
  359.     jne    asm_generic_divide_fail
  360.     cmp    cl,6
  361.     je    asm_generic_divide_flo_flo
  362.     cmp    cl,26
  363.     jne    asm_generic_divide_fail
  364.     mov    ecx,ebx
  365.     shl    ecx,6
  366.     je    asm_generic_divide_fail
  367.     and    edx,ebp
  368.     sar    ecx,6
  369.     fld    qword ptr 4[edx]            ; fldd
  370.     mov    dword ptr [edi],ecx
  371.     fidiv    dword ptr [edi]
  372.     jmp    asm_generic_flonum_result
  373. asm_generic_divide_fix:
  374.     cmp    cl,6
  375.     jne    asm_generic_divide_fail
  376.     mov    ecx,edx
  377.     shl    ecx,6
  378.     je    asm_generic_divide_fail
  379.     and    ebx,ebp
  380.     sar    ecx,6
  381.     fld    qword ptr 4[ebx]            ; fldd
  382.     mov    dword ptr [edi],ecx
  383.     fidivr    dword ptr [edi]
  384.     jmp    asm_generic_flonum_result
  385. asm_generic_divide_flo_flo:
  386.     mov    ecx,ebx
  387.     and    ecx,ebp
  388.     fld    qword ptr 4[ecx]            ; fldd
  389.     ftst
  390.     fstsw    ax
  391.     sahf
  392.     je    asm_generic_divide_by_zero
  393.     and    edx,ebp
  394.     fdivr    qword ptr 4[edx]
  395.     jmp    asm_generic_flonum_result    
  396. asm_generic_divide_by_zero:
  397.     fstp    st(0)                    ; Pop second arg
  398. asm_generic_divide_fail:
  399.     push    ebx
  400.     push    edx
  401.     mov    al,023H
  402.     jmp    scheme_to_interface
  403.     public _asm_generic_decrement
  404. _asm_generic_decrement:
  405.     pop    edx
  406.     mov    eax,edx
  407.     shr    eax,26
  408.     cmp    al,26
  409.     je    asm_generic_decrement_fix
  410.     cmp    al,6
  411.     jne    asm_generic_decrement_fail
  412.     and    edx,ebp
  413.     fld1
  414.     fsubr    qword ptr 4[edx]
  415.     jmp    asm_generic_flonum_result
  416. asm_generic_decrement_fix:
  417.     mov    eax,edx
  418.     shl    eax,6
  419.     sub    eax,64
  420.     jno    asm_generic_fixnum_result
  421. asm_generic_decrement_fail:
  422.     push    edx
  423.     mov    al,022H
  424.     jmp    scheme_to_interface
  425.     public _asm_generic_increment
  426. _asm_generic_increment:
  427.     pop    edx
  428.     mov    eax,edx
  429.     shr    eax,26
  430.     cmp    al,26
  431.     je    asm_generic_increment_fix
  432.     cmp    al,6
  433.     jne    asm_generic_increment_fail
  434.     and    edx,ebp
  435.     fld1
  436.     fadd    qword ptr 4[edx]
  437.     jmp    asm_generic_flonum_result
  438. asm_generic_increment_fix:
  439.     mov    eax,edx
  440.     shl    eax,6
  441.     add    eax,64
  442.     jno    asm_generic_fixnum_result
  443. asm_generic_increment_fail:
  444.     push    edx
  445.     mov    al,026H
  446.     jmp    scheme_to_interface
  447.     public _asm_generic_negative
  448. _asm_generic_negative:
  449.     pop    edx
  450.     mov    eax,edx
  451.     shr    eax,26
  452.     cmp    al,26
  453.     je    asm_generic_negative_fix
  454.     cmp    al,6
  455.     jne    asm_generic_negative_fail
  456.     and    edx,ebp
  457.     fld    qword ptr 4[edx]
  458.     ftst
  459.     fstsw    ax
  460.     fstp    st(0)
  461.     sahf
  462.     jb    asm_generic_return_sharp_t
  463.     jmp    asm_generic_return_sharp_f
  464. asm_generic_negative_fix:
  465.     mov    eax,edx
  466.     shl    eax,6
  467.     cmp    eax,0
  468.     jl    asm_generic_return_sharp_t
  469.     jmp    asm_generic_return_sharp_f
  470. asm_generic_negative_fail:
  471.     push    edx
  472.     mov    al,02aH
  473.     jmp    scheme_to_interface
  474.     public _asm_generic_positive
  475. _asm_generic_positive:
  476.     pop    edx
  477.     mov    eax,edx
  478.     shr    eax,26
  479.     cmp    al,26
  480.     je    asm_generic_positive_fix
  481.     cmp    al,6
  482.     jne    asm_generic_positive_fail
  483.     and    edx,ebp
  484.     fld    qword ptr 4[edx]
  485.     ftst
  486.     fstsw    ax
  487.     fstp    st(0)
  488.     sahf
  489.     ja    asm_generic_return_sharp_t
  490.     jmp    asm_generic_return_sharp_f
  491. asm_generic_positive_fix:
  492.     mov    eax,edx
  493.     shl    eax,6
  494.     cmp    eax,0
  495.     jg    asm_generic_return_sharp_t
  496.     jmp    asm_generic_return_sharp_f
  497. asm_generic_positive_fail:
  498.     push    edx
  499.     mov    al,02cH
  500.     jmp    scheme_to_interface
  501.     public _asm_generic_zero
  502. _asm_generic_zero:
  503.     pop    edx
  504.     mov    eax,edx
  505.     shr    eax,26
  506.     cmp    al,26
  507.     je    asm_generic_zero_fix
  508.     cmp    al,6
  509.     jne    asm_generic_zero_fail
  510.     and    edx,ebp
  511.     fld    qword ptr 4[edx]
  512.     ftst
  513.     fstsw    ax
  514.     fstp    st(0)
  515.     sahf
  516.     je    asm_generic_return_sharp_t
  517.     jmp    asm_generic_return_sharp_f
  518. asm_generic_zero_fix:
  519.     mov    eax,edx
  520.     shl    eax,6
  521.     cmp    eax,0
  522.     je    asm_generic_return_sharp_t
  523.     jmp    asm_generic_return_sharp_f
  524. asm_generic_zero_fail:
  525.     push    edx
  526.     mov    al,02dH
  527.     jmp    scheme_to_interface
  528.     public _asm_generic_add
  529. _asm_generic_add:
  530.     pop    edx
  531.     pop    ebx
  532.     mov    eax,edx
  533.     mov    ecx,ebx
  534.     shr    eax,26
  535.     shr    ecx,26
  536.     cmp    al,26
  537.     je    asm_generic_add_fix
  538.     cmp    al,6
  539.     jne    asm_generic_add_fail
  540.     cmp    cl,6
  541.     je    asm_generic_add_flo_flo
  542.     cmp    cl,26
  543.     jne    asm_generic_add_fail
  544.     shl    ebx,6
  545.     and    edx,ebp
  546.     sar    ebx,6
  547.     fld    qword ptr 4[edx]            ; fldd
  548.     mov    dword ptr [edi],ebx
  549.     fiadd    dword ptr [edi]                ; fisubl
  550.     jmp    asm_generic_flonum_result
  551. asm_generic_add_fix:
  552.     cmp    cl,6
  553.     je    asm_generic_add_fix_flo
  554.     cmp    cl,26
  555.     jne    asm_generic_add_fail
  556.     mov    eax,edx
  557.     mov    ecx,ebx
  558.     shl    eax,6
  559.     shl    ecx,6
  560.     add    eax,ecx        ; subl
  561.     jno    asm_generic_fixnum_result
  562. asm_generic_add_fail:
  563.     push    ebx
  564.     push    edx
  565.     mov    al,02bH
  566.     jmp    scheme_to_interface
  567. asm_generic_add_flo_flo:
  568.     and    edx,ebp
  569.     and    ebx,ebp
  570.     fld    qword ptr 4[edx]            ; fldd
  571.     fadd    qword ptr 4[ebx]            ; fsubl
  572.     jmp    asm_generic_flonum_result    
  573. asm_generic_add_fix_flo:
  574.     shl    edx,6
  575.     and    ebx,ebp
  576.     sar    edx,6
  577.     fld    qword ptr 4[ebx]            ; fldd
  578.     mov    dword ptr [edi],edx
  579.     fiadd    dword ptr [edi]            ; fisubrl
  580.     jmp    asm_generic_flonum_result
  581.     public _asm_generic_subtract
  582. _asm_generic_subtract:
  583.     pop    edx
  584.     pop    ebx
  585.     mov    eax,edx
  586.     mov    ecx,ebx
  587.     shr    eax,26
  588.     shr    ecx,26
  589.     cmp    al,26
  590.     je    asm_generic_subtract_fix
  591.     cmp    al,6
  592.     jne    asm_generic_subtract_fail
  593.     cmp    cl,6
  594.     je    asm_generic_subtract_flo_flo
  595.     cmp    cl,26
  596.     jne    asm_generic_subtract_fail
  597.     shl    ebx,6
  598.     and    edx,ebp
  599.     sar    ebx,6
  600.     fld    qword ptr 4[edx]            ; fldd
  601.     mov    dword ptr [edi],ebx
  602.     fisub    dword ptr [edi]                ; fisubl
  603.     jmp    asm_generic_flonum_result
  604. asm_generic_subtract_fix:
  605.     cmp    cl,6
  606.     je    asm_generic_subtract_fix_flo
  607.     cmp    cl,26
  608.     jne    asm_generic_subtract_fail
  609.     mov    eax,edx
  610.     mov    ecx,ebx
  611.     shl    eax,6
  612.     shl    ecx,6
  613.     sub    eax,ecx        ; subl
  614.     jno    asm_generic_fixnum_result
  615. asm_generic_subtract_fail:
  616.     push    ebx
  617.     push    edx
  618.     mov    al,028H
  619.     jmp    scheme_to_interface
  620. asm_generic_subtract_flo_flo:
  621.     and    edx,ebp
  622.     and    ebx,ebp
  623.     fld    qword ptr 4[edx]            ; fldd
  624.     fsub    qword ptr 4[ebx]            ; fsubl
  625.     jmp    asm_generic_flonum_result    
  626. asm_generic_subtract_fix_flo:
  627.     shl    edx,6
  628.     and    ebx,ebp
  629.     sar    edx,6
  630.     fld    qword ptr 4[ebx]            ; fldd
  631.     mov    dword ptr [edi],edx
  632.     fisubr    dword ptr [edi]            ; fisubrl
  633.     jmp    asm_generic_flonum_result
  634.     public _asm_generic_multiply
  635. _asm_generic_multiply:
  636.     pop    edx
  637.     pop    ebx
  638.     mov    eax,edx
  639.     mov    ecx,ebx
  640.     shr    eax,26
  641.     shr    ecx,26
  642.     cmp    al,26
  643.     je    asm_generic_multiply_fix
  644.     cmp    al,6
  645.     jne    asm_generic_multiply_fail
  646.     cmp    cl,6
  647.     je    asm_generic_multiply_flo_flo
  648.     cmp    cl,26
  649.     jne    asm_generic_multiply_fail
  650.     shl    ebx,6
  651.     and    edx,ebp
  652.     sar    ebx,6
  653.     fld    qword ptr 4[edx]            ; fldd
  654.     mov    dword ptr [edi],ebx
  655.     fimul    dword ptr [edi]                ; fisubl
  656.     jmp    asm_generic_flonum_result
  657. asm_generic_multiply_fix:
  658.     cmp    cl,6
  659.     je    asm_generic_multiply_fix_flo
  660.     cmp    cl,26
  661.     jne    asm_generic_multiply_fail
  662.     mov    eax,edx
  663.     mov    ecx,ebx
  664.     shl    eax,6
  665.     shl    ecx,6
  666.     imul    eax,ecx        ; subl
  667.     jno    asm_generic_fixnum_result
  668. asm_generic_multiply_fail:
  669.     push    ebx
  670.     push    edx
  671.     mov    al,029H
  672.     jmp    scheme_to_interface
  673. asm_generic_multiply_flo_flo:
  674.     and    edx,ebp
  675.     and    ebx,ebp
  676.     fld    qword ptr 4[edx]            ; fldd
  677.     fmul    qword ptr 4[ebx]            ; fsubl
  678.     jmp    asm_generic_flonum_result    
  679. asm_generic_multiply_fix_flo:
  680.     shl    edx,6
  681.     and    ebx,ebp
  682.     sar    edx,6
  683.     fld    qword ptr 4[ebx]            ; fldd
  684.     mov    dword ptr [edi],edx
  685.     fimul    dword ptr [edi]            ; fisubrl
  686.     jmp    asm_generic_flonum_result
  687.     public _asm_generic_equal
  688. _asm_generic_equal:
  689.     pop    edx
  690.     pop    ebx
  691.     mov    eax,edx
  692.     mov    ecx,ebx
  693.     shr    eax,26
  694.     shr    ecx,26
  695.     cmp    al,26
  696.     je    asm_generic_equal_fix
  697.     cmp    al,6
  698.     jne    asm_generic_equal_fail
  699.     cmp    cl,6
  700.     je    asm_generic_equal_flo_flo
  701.     cmp    cl,26
  702.     jne    asm_generic_equal_fail
  703.     shl    ebx,6
  704.     and    edx,ebp
  705.     sar    ebx,6
  706.     fld    qword ptr 4[edx]            ; fldd
  707.     mov    dword ptr [edi],ebx
  708.     ficomp    dword ptr [edi]
  709.     fstsw    ax
  710.     sahf
  711.     je    asm_generic_return_sharp_t
  712.     jmp    asm_generic_return_sharp_f
  713. asm_generic_equal_fix:
  714.     cmp    cl,6
  715.     je    asm_generic_equal_fix_flo
  716.     cmp    cl,26
  717.     jne    asm_generic_equal_fail
  718.     shl    edx,6
  719.     shl    ebx,6
  720.     cmp    edx,ebx
  721.     je    asm_generic_return_sharp_t    
  722.     jmp    asm_generic_return_sharp_f
  723. asm_generic_equal_flo_flo:
  724.     and    edx,ebp
  725.     and    ebx,ebp
  726.     fld    qword ptr 4[edx]            ; fldd
  727.     fcomp    qword ptr 4[ebx]
  728.     fstsw    ax
  729.     sahf
  730.     je    asm_generic_return_sharp_t
  731.     jmp    asm_generic_return_sharp_f
  732. asm_generic_equal_fix_flo:
  733.     shl    edx,6
  734.     and    ebx,ebp
  735.     sar    edx,6
  736.     mov    dword ptr [edi],edx
  737.     fild    dword ptr [edi]
  738.     fcomp    qword ptr 4[ebx]
  739.     fstsw    ax
  740.     sahf
  741.     je    asm_generic_return_sharp_t
  742.     jmp    asm_generic_return_sharp_f
  743. asm_generic_equal_fail:
  744.     push    ebx
  745.     push    edx
  746.     mov    al,024H
  747.     jmp    scheme_to_interface
  748.     public _asm_generic_greater
  749. _asm_generic_greater:
  750.     pop    edx
  751.     pop    ebx
  752.     mov    eax,edx
  753.     mov    ecx,ebx
  754.     shr    eax,26
  755.     shr    ecx,26
  756.     cmp    al,26
  757.     je    asm_generic_greater_fix
  758.     cmp    al,6
  759.     jne    asm_generic_greater_fail
  760.     cmp    cl,6
  761.     je    asm_generic_greater_flo_flo
  762.     cmp    cl,26
  763.     jne    asm_generic_greater_fail
  764.     shl    ebx,6
  765.     and    edx,ebp
  766.     sar    ebx,6
  767.     fld    qword ptr 4[edx]            ; fldd
  768.     mov    dword ptr [edi],ebx
  769.     ficomp    dword ptr [edi]
  770.     fstsw    ax
  771.     sahf
  772.     ja    asm_generic_return_sharp_t
  773.     jmp    asm_generic_return_sharp_f
  774. asm_generic_greater_fix:
  775.     cmp    cl,6
  776.     je    asm_generic_greater_fix_flo
  777.     cmp    cl,26
  778.     jne    asm_generic_greater_fail
  779.     shl    edx,6
  780.     shl    ebx,6
  781.     cmp    edx,ebx
  782.     jg    asm_generic_return_sharp_t    
  783.     jmp    asm_generic_return_sharp_f
  784. asm_generic_greater_flo_flo:
  785.     and    edx,ebp
  786.     and    ebx,ebp
  787.     fld    qword ptr 4[edx]            ; fldd
  788.     fcomp    qword ptr 4[ebx]
  789.     fstsw    ax
  790.     sahf
  791.     ja    asm_generic_return_sharp_t
  792.     jmp    asm_generic_return_sharp_f
  793. asm_generic_greater_fix_flo:
  794.     shl    edx,6
  795.     and    ebx,ebp
  796.     sar    edx,6
  797.     mov    dword ptr [edi],edx
  798.     fild    dword ptr [edi]
  799.     fcomp    qword ptr 4[ebx]
  800.     fstsw    ax
  801.     sahf
  802.     ja    asm_generic_return_sharp_t
  803.     jmp    asm_generic_return_sharp_f
  804. asm_generic_greater_fail:
  805.     push    ebx
  806.     push    edx
  807.     mov    al,025H
  808.     jmp    scheme_to_interface
  809.     public _asm_generic_less
  810. _asm_generic_less:
  811.     pop    edx
  812.     pop    ebx
  813.     mov    eax,edx
  814.     mov    ecx,ebx
  815.     shr    eax,26
  816.     shr    ecx,26
  817.     cmp    al,26
  818.     je    asm_generic_less_fix
  819.     cmp    al,6
  820.     jne    asm_generic_less_fail
  821.     cmp    cl,6
  822.     je    asm_generic_less_flo_flo
  823.     cmp    cl,26
  824.     jne    asm_generic_less_fail
  825.     shl    ebx,6
  826.     and    edx,ebp
  827.     sar    ebx,6
  828.     fld    qword ptr 4[edx]            ; fldd
  829.     mov    dword ptr [edi],ebx
  830.     ficomp    dword ptr [edi]
  831.     fstsw    ax
  832.     sahf
  833.     jb    asm_generic_return_sharp_t
  834.     jmp    asm_generic_return_sharp_f
  835. asm_generic_less_fix:
  836.     cmp    cl,6
  837.     je    asm_generic_less_fix_flo
  838.     cmp    cl,26
  839.     jne    asm_generic_less_fail
  840.     shl    edx,6
  841.     shl    ebx,6
  842.     cmp    edx,ebx
  843.     jl    asm_generic_return_sharp_t    
  844.     jmp    asm_generic_return_sharp_f
  845. asm_generic_less_flo_flo:
  846.     and    edx,ebp
  847.     and    ebx,ebp
  848.     fld    qword ptr 4[edx]            ; fldd
  849.     fcomp    qword ptr 4[ebx]
  850.     fstsw    ax
  851.     sahf
  852.     jb    asm_generic_return_sharp_t
  853.     jmp    asm_generic_return_sharp_f
  854. asm_generic_less_fix_flo:
  855.     shl    edx,6
  856.     and    ebx,ebp
  857.     sar    edx,6
  858.     mov    dword ptr [edi],edx
  859.     fild    dword ptr [edi]
  860.     fcomp    qword ptr 4[ebx]
  861.     fstsw    ax
  862.     sahf
  863.     jb    asm_generic_return_sharp_t
  864.     jmp    asm_generic_return_sharp_f
  865. asm_generic_less_fail:
  866.     push    ebx
  867.     push    edx
  868.     mov    al,027H
  869.     jmp    scheme_to_interface
  870.     public _asm_generic_quotient
  871. _asm_generic_quotient:
  872.     mov    al,037H
  873.     jmp    scheme_to_interface
  874.     public _asm_generic_remainder
  875. _asm_generic_remainder:
  876.     mov    al,038H
  877.     jmp    scheme_to_interface
  878.     public _asm_generic_modulo
  879. _asm_generic_modulo:
  880.     mov    al,039H
  881.     jmp    scheme_to_interface
  882.     public _asm_nofp_decrement
  883. _asm_nofp_decrement:
  884.     mov    al,022H
  885.     jmp    scheme_to_interface
  886.     public _asm_nofp_divide
  887. _asm_nofp_divide:
  888.     mov    al,023H
  889.     jmp    scheme_to_interface
  890.     public _asm_nofp_equal
  891. _asm_nofp_equal:
  892.     mov    al,024H
  893.     jmp    scheme_to_interface
  894.     public _asm_nofp_greater
  895. _asm_nofp_greater:
  896.     mov    al,025H
  897.     jmp    scheme_to_interface
  898.     public _asm_nofp_increment
  899. _asm_nofp_increment:
  900.     mov    al,026H
  901.     jmp    scheme_to_interface
  902.     public _asm_nofp_less
  903. _asm_nofp_less:
  904.     mov    al,027H
  905.     jmp    scheme_to_interface
  906.     public _asm_nofp_subtract
  907. _asm_nofp_subtract:
  908.     mov    al,028H
  909.     jmp    scheme_to_interface
  910.     public _asm_nofp_multiply
  911. _asm_nofp_multiply:
  912.     mov    al,029H
  913.     jmp    scheme_to_interface
  914.     public _asm_nofp_negative
  915. _asm_nofp_negative:
  916.     mov    al,02aH
  917.     jmp    scheme_to_interface
  918.     public _asm_nofp_add
  919. _asm_nofp_add:
  920.     mov    al,02bH
  921.     jmp    scheme_to_interface
  922.     public _asm_nofp_positive
  923. _asm_nofp_positive:
  924.     mov    al,02cH
  925.     jmp    scheme_to_interface
  926.     public _asm_nofp_zero
  927. _asm_nofp_zero:
  928.     mov    al,02dH
  929.     jmp    scheme_to_interface
  930.     public _asm_nofp_quotient
  931. _asm_nofp_quotient:
  932.     mov    al,037H
  933.     jmp    scheme_to_interface
  934.     public _asm_nofp_remainder
  935. _asm_nofp_remainder:
  936.     mov    al,038H
  937.     jmp    scheme_to_interface
  938.     public _asm_nofp_modulo
  939. _asm_nofp_modulo:
  940.     mov    al,039H
  941.     jmp    scheme_to_interface
  942. end
  943.